package com.zhan.utils;

import java.io.IOException;
import java.net.URL;
import java.util.Properties;

public final class PropertiesUtils {
	 private static Properties properties=new Properties();  
     
	    static{  
	        try {  
	            //注意属性配置文件所在的路径  
	        	Thread.currentThread().getContextClassLoader().getResource("/test.properties");
	            properties.load(PropertiesUtils.class.getClassLoader().getResourceAsStream("classpath:db。simsun.tcc"));  
	        } catch (Exception e) {  
	            System.out.println(e.getMessage());  
	        }  
	    }  
	      
	    //读取属性配置文件中的某个属性对应的值  
	    public static String readProperty(String property) throws IOException{  
	    	 URL url = Thread.currentThread().getContextClassLoader().getResource("classpath:test.properties");
	    	 properties.load(PropertiesUtils.class.getClassLoader().getResourceAsStream("classpath:/test.properties"));
	    	 return properties.getProperty("dd");
	    }  
	    
	    public static void main(String[] args) {
			
		}
}
